package cn.com.stary1993.kite.captcha.support.behavior;

import cloud.tianai.captcha.generator.ImageCaptchaGenerator;
import cloud.tianai.captcha.generator.common.model.dto.GenerateParam;
import cloud.tianai.captcha.resource.ImageCaptchaResourceManager;
import cloud.tianai.captcha.validator.ImageCaptchaValidator;
import cloud.tianai.captcha.validator.common.model.dto.ImageCaptchaTrack;
import cn.com.stary1993.kite.captcha.support.Captcha;
import cn.com.stary1993.kite.captcha.vo.BehaviorCaptchaVO;
import cn.com.stary1993.kite.captcha.vo.CaptchaResponse;
import cn.com.stary1993.kite.captcha.vo.CaptchaVO;

/**
 * 行为验证码应用程序
 *
 * @author stary1993
 */
public abstract class BehaviorImageCaptcha implements Captcha {

	public abstract CaptchaResponse<? extends CaptchaVO> generate();

	/**
	 * 生成滑块验证码
	 * @param type type类型
	 * @return CaptchaResponse<SliderCaptchaVO>
	 */
	public abstract CaptchaResponse<BehaviorCaptchaVO> generate(String type);

	/**
	 * 生成滑块验证码
	 * @param captchaImageType 要生成webp还是jpg类型的图片
	 * @return CaptchaResponse<SliderCaptchaVO>
	 */
	public abstract CaptchaResponse<BehaviorCaptchaVO> generate(BehaviorImageCaptchaFormat captchaImageType);

	/**
	 * 生成验证码
	 * @param type type
	 * @param captchaImageType CaptchaImageType
	 * @return CaptchaResponse<ImageCaptchaVO>
	 */
	public abstract CaptchaResponse<BehaviorCaptchaVO> generate(String type,
			BehaviorImageCaptchaFormat captchaImageType);

	/**
	 * 生成滑块验证码
	 * @param param param
	 * @return CaptchaResponse<SliderCaptchaVO>
	 */
	public abstract CaptchaResponse<BehaviorCaptchaVO> generate(GenerateParam param);

	/**
	 * 匹配
	 * @param id 验证码的ID
	 * @param imageCaptchaTrack 滑动轨迹
	 * @return 匹配成功返回true， 否则返回false
	 */
	public abstract boolean matching(String id, ImageCaptchaTrack imageCaptchaTrack);

	/**
	 * 获取验证码资源管理器
	 * @return SliderCaptchaResourceManager
	 */
	public abstract ImageCaptchaResourceManager getImageCaptchaResourceManager();

	/**
	 * 获取验证码验证器
	 * @return SliderCaptchaValidator
	 */
	public abstract ImageCaptchaValidator getImageCaptchaValidator();

	/**
	 * 设置 SliderCaptchaValidator 验证码验证器
	 * @param imageCaptchaValidator imageCaptchaValidator
	 */
	public abstract void setImageCaptchaValidator(ImageCaptchaValidator imageCaptchaValidator);

	/**
	 * 获取验证码生成器
	 * @return SliderCaptchaTemplate
	 */
	public abstract ImageCaptchaGenerator getImageCaptchaTemplate();

	/**
	 * 设置 ImageCaptchaGenerator 验证码生成器
	 * @param imageCaptchaGenerator SliderCaptchaGenerator
	 */
	public abstract void setImageCaptchaTemplate(ImageCaptchaGenerator imageCaptchaGenerator);

}
